<?php $this->load->view('header') ?>

<div id="content">
<div class="column full fl">
		
		<div class="box">
		<div class="box-header">Rincian Akun</div>
		<div class="box-content box-table">
		<br />
		
		&nbsp;&nbsp;	
		<?php echo isAccess('akuntansi','akun','add') ? anchor('akuntansi/akunRincian/add', '<span class="icon_text addnew"></span>Setting Periode Baru', 'class="button white"') : ''; ?>
		
		<?php if($dataView):?>
			<?php //echo isAccess('akuntansi','akun','edit') ? anchor('akuntansi/akunRincian/edit', '<span class="icon_text edit"></span>Edit Akun Periode', 'class="button white"') : ''; ?>
		<?php endif;?> 
		<div class="clear"></div>

        	<?php if (isset($errorMessage)) : ?>
            	<div class="notification <?php echo ((isset($isSuccess) && $isSuccess) ? 'success' : 'error');?>"><?php echo $errorMessage; ?></div>
	        <?php endif; ?>    	
	        <br />
	        
	        <table class="tablebox">
	        	<tr class='even'>
	        		<td width='50'><b>Periode</b></td>
	        		<td width='10'> : </td>
	        		<td><b><?php echo monthName(date('m')).' '.date('Y')?><b></td>
	        	</tr>
	        	<tr class='even'>
	        		<td width='50'><b>Tipe</b></td>
	        		<td width='10'> : </td>
	        		<td>
	        			<select name='tipe' id='tipe' class='modalLoader'>
                        	<option value='all'>Semua Tipe</option>
                        	<?php if($listAkunTipe) foreach($listAkunTipe as $tipe=>$list):?>
                        		<optgroup label='<?php echo $tipe?>'></optgroup>
                        		
                        		<?php if($list) foreach($list as $id=>$name):?>
                        			<option value='<?php echo $id?>' <?php echo get_data($uri_to_assoc,'tipe') == $id ? 'selected="selected"' : '';?>>				                   
	                        			<?php echo '&nbsp;&nbsp;&nbsp;'.$name?>
									</option>
                        		<?php endforeach;?>
                        		
                        	<?php endforeach;?>
                        </select>
					</td>
	        	</tr>
	        </table>
	        <br />

            <?php echo $paging?>
            <table class="tablebox">
            <thead class="table-header" style="border-top:1px solid #ccc;border-bottom:1px solid #ccc">
                <tr>
                	<th width="10">No</th>
                    <th width="150">Tipe</th>
                    <th>Kode</th>
                    <th>Nama</th>
                    <th>Saldo</th>
                    <th width="200">Action</th>
                </tr>
            </thead>
            <tbody>
            	<?php $no = get_data($uri_to_assoc,'page')+1;?>
                <?php if ($dataView) foreach($dataView as $key=>$row) : ?>
                <?php $class = $no % 2 == 0 ? 'even' : 'odd' ?>
                <tr class=<?php echo $class?> style='font-weight:bold;'>
                	<td><?php echo $no?></td>
                	
                	<!-- Tipe -->
                	<td>
                	<?php if($key > 0):?>
                		<?php echo $dataView[$key-1]['akunTipeNama'] == $row['akunTipeNama'] ? '' : $row['akunTipeNama'];?>
                	<?php else:?>
                    	<?php echo $row['akunTipeNama'];?>
                    <?php endif;?>
                    </td>
                    
                    <td><?php echo get_data($row,'akunKode')?></td>
                    <td><?php echo get_data($row,'akunNama')?></td>
                    <td>Rp. <span style="float:right;"><?php echo number_format($row['akunSaldo']);?></span></td>

                    <td>
                        <?php echo isAccess('akuntansi','akunrincian','edit') ? anchor('akuntansi/akunRincian/edit/id/' . $row['akunId'],'<span class="icon_text edit"></span>Edit', 'class="button white"', 'class="button white"') : ''?>
                        <?php echo isAccess('akuntansi','akunrincian','delete') ? anchor('akuntansi/akunRincian/view/page/'.$uri_to_assoc['page'].'/action/delete/id/' . $row['akunId'],'<span class="icon_text cancel"></span>Hapus', array('onClick' => "return confirm('".$this->lang->line('global_confirm_delete')."')" , 'class' => "button white")) : ''?>
                    </td>
                </tr>
                <?php $no++?>
                <?php endforeach;?>
            </tbody>
            <?php if($dataView):?>
            <tfoot>
	            <tr class='<?php echo ($no+1) % 2 == 0 ? 'even' : 'odd' ?>' style='font-weight:bold;'>
            		<td></td><td></td><td></td><td></td><td></td>
            		<td>
            			<br />
            			<?php echo isAccess ('akuntansi', 'akunrincian', 'exportpdf') ? anchor('akuntansi/akunRincian/exportPdf/', '<span class="icon_text pdf"></span>Export Data', 'class="button white"') : '';?>
            			<br />    
            		</td>
	            </tr>
            </tfoot>
            <?php endif;?>
            </table>
            <div id="paging">
            <?php echo $paging?>
            </div>
		</div>
		</div>
	
	</div>

<script type="text/javascript">
<!--
jQuery(document).ready(function($){
	tipeChange = function() {
        if (this.value)
            document.location.href = site_url('akuntansi/akunRincian/view/tipe/' + this.value + '/page/0/');
        else
        	document.location.href = site_url('akuntansi/akunRincian/view/tipe/all/');
    };
    $('#tipe').bind('change',tipeChange);
});
//-->
</script>
<?php $this->load->view('footer') ?>